<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="{$title}">
    <meta name="description" content="{$title}">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATICADMIN__/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/font-awesome.min93e3.css" rel="stylesheet">

    <!-- Data Tables -->
    <link href="__STATICADMIN__/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/style.min.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>广告信息</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-2">
                            <div class="input-group">
                                <a href="{:U('AD/add')}" class="btn btn-outline btn-primary ">广告添加</a>
                            </div>
                        </div>
                        <form name="admin_list" id="admin_list" action="{:U()}" method="get">
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入关键词" class="input-sm form-control" name="word" id="word" value="{$word}">
                                        <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary">搜 索</button>
                                        </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>广告名</th>
                            <th>缩略图</th>
                            <th>广告位</th>
                            <th>广告状态</th>
                            <th>链接</th>
                            <th>排序</th>
                            <th>到期时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="list" id="v">
                            <tr class="gradeA">
                                <td>{$v.id}</td>
                                <td>{$v.ad_name}</td>
                                <td><img alt="image" class="img-thumbnail" src="{$v.litimg}" width="100" height="100"></td>
                                <td>
                                    <switch name="v.type">
                                        <case value="1">banner</case>
                                        <case value="2">顶部广告</case>
                                        <case value="3">促销广告</case>
                                        <case value="4">新品广告</case>
                                        <case value="5">限时广告</case>
                                        <case value="6">商品广告</case>
                                    </switch>

                                </td>
                                <td> <a id="expire{$v.id}"  class="btn btn-{$v['status']?'primary':'danger'} btn-xs" href="javascript:;" onclick="changState({$v.id})">{$v['status']? '正常':'已到期'}</a></td>
                                <td>{$v.link_url}</td>
                                <td>{$v.sort_order}</td>
                                <td>{$v['time']|date='Y-m-d H:i',###}</td>
                                <td><a href="javascript:;" class="btn btn-primary btn-xs" onclick="edit({$v.id})"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;<a href="javascript:;" class="btn btn-danger btn-xs" onclick="del({$v.id})"><i class="fa fa-trash-o"></i> 删除</a></td>
                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    {$page}
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__STATICADMIN__/js/jquery.min.js"></script>
<script src="__STATICADMIN__/js/bootstrap.min.js"></script>
<script src="__STATICADMIN__/js/plugins/jeditable/jquery.jeditable.js"></script>
<script src="__STATICADMIN__/js/common.js"></script>
<script src="__STATICADMIN__/js/fileinput.min.js"></script>
<script src="__STATIC__/public/layui/lay/dest/layui.all.js"></script>
<!-- 自定义js -->
<script src="__STATICADMIN__/js/content.min.js"></script>
<script>
    //删除
    function  del(id){
        sxshop.del(id,"{:U('Ad/del')}","{:U()}");
    }
    //修改
    function edit(id){
        console.log();
        location.href='/admin/Ad/edit/id/'+id+'.html';
    }
    //修改状态
    function changState(id){
        var objectState = $('#expire'+id);
        sxshop.expire(id,"{:U('changState')}",objectState);
    }

</script>

</body>

</html>

